package com.auto.util;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.auto.entity.Task;
import com.auto.rep.TaskRep;

public class DbInit {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(
				"spring/jpa.xml");
		//ArtRep artRep = ctx.getBean("artRep", ArtRep.class);
		TaskRep taskRep = ctx.getBean("taskRep", TaskRep.class);

		/*Art art1 = new Art();
		art1.setTitle("art1");
		art1.setContent("art1。。。");

		Art art2 = new Art();
		art2.setTitle("art2");
		art2.setContent("art2。。。");
		Art art11 = artRep.save(art1);
		Art art22 = artRep.save(art2);
		LOG.notice(art11.getId());
		Task task = new Task();
		task.setName("task1");
		task.setArts(Sets.newHashSet(art11, art22));
		
		Task taskResult = taskRep.save(task);
		
		LOG.info("art:{}",taskResult.getId());*/
		Task task = taskRep.findOne(9L);
		task.getArts();

	}

}
